package com.jdk.learn.juc2.thread;

import java.util.concurrent.locks.ReentrantLock;

/**
 * 类功能描述:
 *
 * @author bgt
 * @version V1.0
 * @since 2019-02-01 17:07
 */
public class LockDemo {
    public static void main(String[] args) {
        // 公平锁
        ReentrantLock fairLock=new ReentrantLock(true);
        // 非公平锁
        ReentrantLock nonFairLock=new ReentrantLock(false);


    }
}

class CanRepeatIn{
    public synchronized void hello(){
        System.out.println("hello");
    }
    public synchronized void gethello(){
        System.out.println("get hello");
        hello();
    }

    public static void main(String[] args) {
        CanRepeatIn in=new CanRepeatIn();
        in.gethello();
    }
}
